package com.qiao;

public class Dog {
    //姓名
    private String name;
    //年龄
    private int age;
    //颜色
    private String color;

    public Dog() {

    }

    /**
     * 构造方法 用来实例化 狗这个对象
     * @param name
     * @param age
     * @param color
     */
    public Dog(String name, int age, String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public void barks() {
        System.out.println(this.name +" 正在汪汪汪叫....");
    }

    public void eat() {
        System.out.println(this.name +" 正在吃狗粮.....");
    }

    public static void staticFun() {
        System.out.println("staticFun.....");
    }

    public void show() {
        System.out.println("狗名："+this.name +" 年龄："+this.age
                +" 颜色："+this.color);
    }

    public String toString() {
        String ret = "狗名："+this.name +" 年龄："+this.age
                +" 颜色："+this.color;//定义一个字符串
        return ret;
    }//自己模拟实现Object的toString方法

/*    @Override
    public String toString() {
        String ret = "Dog{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", color='" + color + '\'' +
                '}';
        return ret;
    }*/ //编译器自己完成  ------》快捷键Alt+Insert的toString（）方法快速生成
}
